#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

#define MAX(a, b)	((a) < (b) ? (b) : (a))

int
main(int argc, char **argv)
{
	static int freq[256];
	register int c, i;
	int max = 0;

	while (c = fgetc(stdin), c != EOF) {
		if (ispunct(c) || isalnum(c))
			freq[c]++;
	}

	for (i = 0; i < 256; i++)
		max = MAX(max, freq[i]);

	for (i = max; i > 0; i--) {
		for (c = 0x20; c < 256; c++) {
			if (freq[c] > 0) {
				if (freq[c] >= i)
					fputc('#', stdout);
				else
					fputc(' ', stdout);
			}
		}
		fputc('\n', stdout);
	}

	for (c = 0x20; c <= 0x7f; c++) {
		if (freq[c])
			fputc(c, stdout);
	}
	fputc('\n', stdout);

	return 0;
}
